#!/bin/bash

#---------------------------------------------------------
#
# This is the script is invoked by IBM.ServiceRMd.
#
#   invscout:    when a partition is fully activated.
#   lshsc:       to collect Paritition Map for each SE.
#   HscCimQuery: to get Hsc name, ID , and IPaddress.
#
# These utils are being called this way to in case a
# Java class get exception and the JNI layer might cause
# ServiceRM to hang.
#
#---------------------------------------------------------
#
# echo $1 $2 $3 $4
#
#---------------------------------------------------------

#if [ "$1" == "invscout" ]
#then
#   echo "calling /usr/sbin/invscout -c -v -o partition -p $2 -m $3 -s $4"
#   /usr/sbin/invscout -c -v -o partition -p $2 -m $3 -s $4
#fi


#---------------------------------------------------------

if [ "$1" == "lshsc" ]
then
   echo "calling /opt/hsc/bin/lshsc -c$2 -w -f$3"
   /opt/hsc/bin/lshsc -c$2 -w -f$3
fi


#---------------------------------------------------------

if [ "$1" == "HscCimQuery" ]
then
   echo "calling HscCimQuery $2 $3"

   export CLASSPATH=/usr/websm/codebase/pluginjars/hmcdebug.jar:.:/usr/websm/codebase/pluginjars/sniacimom.jar:/usr/websm/codebase/pluginjars/xerces.jar:/usr/websm/codebase/pluginjars/HwmcaCommon.jar:/usr/websm/codebase/pluginjars/auifw.jar:/opt/hsc:/opt/IBMJava2-13/jre/lib/ext/ibmjceprovider.jar:/opt/IBMJava2-13/jre/lib/ext/ibmjcefw.jar:/opt/hsc/com/ibm/hsc/sfp/HscCimQuery.class:$CLASSPATH

   /opt/IBMJava2-13/jre/bin/java -Djavax.net.ssl.keyStore=/usr/websm/codebase/SM.pubkr -Djavax.net.ssl.keyStorePassword=defp -DcimomConfigFile=/opt/hsc/data/cimomcfg.properties com.ibm.hsc.sfp.HscCimQuery $2 $3
fi


#---------------------------------------------------------
